package main

import "fmt"

func main() {
	s := "hello你好"
	// 转成rune数组
	runes := []rune(s)
	for i, val := range runes {
		fmt.Printf("i = %d, val=%s\n", i, string(val))
		//fmt.Printf("i = %d, val=%c\n", i, val)
	}
	//
	fmt.Println("========================================")
	for _, val := range s {
		fmt.Printf("val = %c\t", val)
	}
	fmt.Println("\n==========================================")
	// 转换成字节数组
	bytes := []byte(s)
	for _, val := range bytes {
		fmt.Printf("val = %c,", val)
	}
}
